/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.nyquistmeteocal.beans;

import it.nyquistmeteocal.boundary.NotificationManager;
import java.sql.SQLException;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

/**
 *
 * @author gatb27
 */

@Named(value = "counter")
@RequestScoped
public class CountNotificationsBean {
    
    @EJB
    private NotificationManager nm;
    
    private Integer invitesnumber;
    private Integer updatesnumber;
    private Integer deletesnumber;
    private Integer tmrnumber;
    private Integer badweathernumber;
    

    public Integer getInvitesnumber() {
        return invitesnumber;
    }

    public void setInvitesnumber(Integer invitesnumber) {
        this.invitesnumber = invitesnumber;
    }

    public Integer getUpdatesnumber() {
        return updatesnumber;
    }

    public void setUpdatesnumber(Integer updatesnumber) {
        this.updatesnumber = updatesnumber;
    }

    public Integer getDeletesnumber() {
        return deletesnumber;
    }

    public void setDeletesnumber(Integer deletesnumber) {
        this.deletesnumber = deletesnumber;
    }

    public Integer getTmrnumber() {
        return tmrnumber;
    }

    public void setTmrnumber(Integer tmrnumber) {
        this.tmrnumber = tmrnumber;
    }

    public Integer getBadweathernumber() {
        return badweathernumber;
    }

    public void setBadweathernumber(Integer badweathernumber) {
        this.badweathernumber = badweathernumber;
    }
    
    

    
    
    public CountNotificationsBean() {}
    
    public String count() throws SQLException {
        
        invitesnumber = nm.countInvites();
        updatesnumber = nm.countUpdates();
        deletesnumber = nm.countDeletes();
        tmrnumber = nm.countTomorrowRainy();
        badweathernumber = nm.countBadWeather();
        System.out.println(invitesnumber);
        System.out.println(updatesnumber);
        System.out.println(deletesnumber);
        System.out.println(tmrnumber);
        System.out.println(badweathernumber);
        
        
        
        return "/user/event/schedule2";
    }
    
    public String countForSchedule() throws SQLException {
        
        invitesnumber = nm.countInvites();
        updatesnumber = nm.countUpdates();
        deletesnumber = nm.countDeletes();
        tmrnumber = nm.countTomorrowRainy();
        badweathernumber = nm.countBadWeather();
        System.out.println("-----START COUNT FOR SCHEDULE-----");
        System.out.println(invitesnumber);
        System.out.println(updatesnumber);
        System.out.println(deletesnumber);
        System.out.println(tmrnumber);
        System.out.println(badweathernumber);
        System.out.println("-----END COUNT FOR SCHEDULE-----");
        
        
        
        
        return "/user/event/schedule";
    }
    
    public String countForSchedule2() throws SQLException {
        
        invitesnumber = nm.countInvites();
        updatesnumber = nm.countUpdates();
        deletesnumber = nm.countDeletes();
        tmrnumber = nm.countTomorrowRainy();
        badweathernumber = nm.countBadWeather();
        System.out.println("-----START COUNT FOR SCHEDULE-----");
        System.out.println(invitesnumber);
        System.out.println(updatesnumber);
        System.out.println(deletesnumber);
        System.out.println(tmrnumber);
        System.out.println(badweathernumber);
        System.out.println("-----END COUNT FOR SCHEDULE-----");
        
        
        
        
        return "/user/event/schedule2";
    }
    
}
